package pacman;

import java.io.FileNotFoundException;
import java.io.IOException;

/**
 *
 * @author Fernando Pasquini
 */
public class Main
{
  /**
   * Starting function of the pacman game it starts the game paused
   * @param args
   * @throws FileNotFoundException
   * @throws IOException
   * @throws InterruptedException
   */
  public static void main(String[] args) throws FileNotFoundException, IOException, InterruptedException
  {
    Engine engine = new Engine();
    long lastTimer = System.currentTimeMillis();
    long millisPerFrame = 1000/30;
    while(true)
    {
      engine.isAllGhostsDead();
      lastTimer = System.currentTimeMillis();
      engine.runGame();
      Thread.sleep(System.currentTimeMillis() + millisPerFrame - lastTimer);
    }
  }
}
